#include <stdio.h>

int main() {
    int N;
    scanf("%d", &N);
    
    int num;
    int a = -1;        
    int b = 0;          
    int c = 0;       
    int d = 0;    

    for (int i = 0; i < N; i++) {
        scanf("%d", &num);
        if (num % 3 == 0) {
            if (num > a) {
                a = num;
            }
        }
        else if (num % 3 == 1) {
            b++;
        }
        else if (num % 3 == 2) {
            c += num;
            d++;
        }
    }
    
    if (a == -1)
        printf("NONE ");
    else
        printf("%d ", a);
    
    if (b == 0)
        printf("NONE ");
    else
        printf("%d ", b);
    
    if (d == 0)
        printf("NONE");
    else
        printf("%.1f", (double)c / d);
    
    return 0;
}
